<%@ page import="java.util.Map" %>
<%@ page import="java.util.Set" %>
<%@ page import="java.util.Arrays" %>
<%@ page import="bid.entity.User" %>
<%@ page import="bid.util.StringUtils" %>
<%@ page import="bid.dao.UserDao" %>
<%@ page import="bid.dao.impl.UserDaoImpl" %><%--
  Created by IntelliJ IDEA.
  User: oldliu
  Date: 2023-10-24
  Time: 15:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    request.setCharacterEncoding("utf-8");
    User user=new User();
    user.setId(Long.parseLong(request.getParameter("id")));
    user.setName(request.getParameter("name"));
    user.setPassword(request.getParameter("password"));
    user.setUsername(request.getParameter("username"));
    user.setUnit(request.getParameter("unit"));
    user.setIdcard(request.getParameter("idcard"));
    user.setRoleid(Long.parseLong(request.getParameter("role")));
    user.setTelephone(request.getParameter("telephone"));
    user.setEnterdate(StringUtils.toDate(request.getParameter("enterdate")));
    UserDao userDao=new UserDaoImpl();
    int r = userDao.update(user);
    if(r>0){
        //out.print("修改成功");
        //跳转过去
        response.sendRedirect("users.jsp");
        return;
    }else{
        out.print("修改失败，请<a href='javascript:window.history.back();'>返回</a>刷新再试");
    }
//      Map<String, String[]> map = request.getParameterMap();
//      //循环一下
//      for (Map.Entry<String, String[]> x:  map.entrySet()){
//          out.print("<p>");
//          out.print(x.getKey()+"==="+ Arrays.toString(x.getValue()));
//          out.print("</p>");
//      }

%>
</body>
</html>
